/*
 * COPYRIGHT(c) SK telecom 2009
 * This software is the proprietary information of SK telecom.
 *
 * Revision History
 * Author     Date          Description
 * --------   ----------    ------------------
 * redaano    2009. 4. 7.    Description
 *
 */
package com.tistory.admin.common;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.PropertyConfigurator;

/**
 * ConfigListener
 * 
 * @author redaano
 * @version 0.1
 */
public class ConfigListener implements ServletContextListener {

	public void contextInitialized(ServletContextEvent sce) {
		System.out.println("# ConfigListener Initialize START");
		initializeLog4j(sce); // log4j 초기화
		System.out.println("# ConfigListener Initialize END");
	}


	/**
	 * log4j 초기화
	 * 
	 * @param sce
	 */
	private void initializeLog4j(ServletContextEvent sce) {
		String log4jPath = sce.getServletContext().getRealPath("/") + "/WEB-INF/classes/log4j.properties";
		System.out.println("# log4jPath : " + log4jPath);
		PropertyConfigurator.configure(log4jPath);
	}


	public void contextDestroyed(ServletContextEvent sce) {
	}
}
